package leetcode;

/**
 * 买卖股票最佳时机||
 */
public class Solution54 {
    class Solution {
        public int maxProfit(int[] prices) {
            int result = 0;
            for (int i = 1; i < prices.length; i++) {
                int temp = prices[i] - prices[i - 1];
                if (temp > 0) {
                    result += temp;
                }
            }
            return result;
        }
    }
}
